package cn.dicraft.domain;

/**
 * @author 烛远
 * @date 2024/8/8 09:59
 */
public class Sqrt {
    public static void main(String[] args) {

    }


    public double sqrt(double n) {
        int i = Float.floatToIntBits((float) n);
        i = 0x5f375a86 - (i >> 1);
        float x = Float.intBitsToFloat(i);
        x = x * (1.5f - (0.5f * (float) n * x * x));
        double reciprocalSqrt = x;
        return reciprocalSqrt * n;
    }


}
